//
//  NBHomepageViewController.m
//  v2ex-shelves
//
//  Created by xdy on 2018/4/8.
//  Copyright © 2018年 Mac os. All rights reserved.
//

#import "NBHomepageViewController.h"
#import "NBHomeListView.h"
@interface NBHomepageViewController ()
@property(nonatomic,strong)UIButton *listButton;
@property(nonatomic,strong)NBHomeListView *disapperView;
@end

@implementation NBHomepageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor=[UIColor whiteColor];
    [self setupNav];
    
}

-(void)setupNav
{
    self.listButton = [[UIButton alloc]init];
    [self.listButton setTitle:@"全部" forState:UIControlStateNormal];
    [self.listButton setTitleColor:[UIColor colorWithHexString:@"#434343"] forState:UIControlStateNormal];
    [self.listButton setImage:[UIImage imageNamed:@"noselectTopic.png"] forState:UIControlStateNormal];
    self.listButton.titleLabel.font = [UIFont fontWithName:FONT_REGULAR size:18*SCALEPhoneWIDTH];
    [self.listButton sizeToFit];
    self.listButton.bounds = CGRectMake(0, 0, self.listButton.width+10, self.listButton.height);
    [self.listButton addTarget:self action:@selector(portlistClick) forControlEvents:UIControlEventTouchUpInside];
    self.navigationItem.titleView = self.listButton;
    self.disapperView = [[NBHomeListView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 200)];
    [self.view addSubview:self.disapperView];
}

-(void)portlistClick
{
    [self.disapperView showOrHiddenView];
}

- (NSArray<WTNode *> *)nodes
{
    if (_nodes == nil)
    {
        _nodes = [WTNode mj_objectArrayWithFilename: @"nodes.plist"];
    }
    return _nodes;
}
@end
